package com.twu.biblioteca;

/**
 * Created by fish on 14-7-22.
 */
public class User {
    private String name;
    private String password;
    private String libNumber;
    private String email;
    private String phone;

    public User(String name, String password, String libNumber, String email, String phone) {
        this.name = name;
        this.password = password;
        this.libNumber = libNumber;
        this.email = email;
        this.phone = phone;
    }

    public User(String name, String password, String libNumber) {
        this.name = name;
        this.password = password;
        this.libNumber = libNumber;
        this.email="example@some.com";
        this.phone="13012345678";
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getEmail() {
        return email;
    }

    public void setLibNumber(String libNumber) {
        this.libNumber = libNumber;
    }

    public String getLibNumber() {

        return libNumber;
    }

    public String getPhone() {
        return phone;
    }

    public String getName() {
        return name;
    }

    public String getPassword() {
        return password;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof User)) return false;

        User user = (User) o;

        if (!email.equals(user.email)) return false;
        if (!libNumber.equals(user.libNumber)) return false;
        if (!name.equals(user.name)) return false;
        if (!password.equals(user.password)) return false;
        if (!phone.equals(user.phone)) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = name.hashCode();
        result = 31 * result + password.hashCode();
        result = 31 * result + libNumber.hashCode();
        result = 31 * result + email.hashCode();
        result = 31 * result + phone.hashCode();
        return result;
    }
}
